<!-- 任务委托 - 项目专员 -->
<template>
  <view class="page">
    <u--form
      labelPosition="top"
      :model="basicForm"
      ref="form1"
      labelWidth="auto"
      :labelStyle="{
        fontSize: '14px',
        color: '#B2B2B2',
        lineHight: '20px',
      }"
    >
      <view class="basic-style">
        <view class="basic-title basic-border">基础信息</view>
        <u-form-item label="单据编号" prop="billNo" :borderBottom="false">
          <u--input disabled placeholder="请输入单据编号" v-model="basicForm.billNo" border="surround"></u--input>
        </u-form-item>
        <u-form-item label="申请时间" prop="createTime" :borderBottom="false">
          <u--input
            v-model="basicForm.createTime"
            disabled
            placeholder="请选择时间"
            border="surround"
            suffixIcon="calendar-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="申请人" prop="handlerId" :borderBottom="false">
          <h-select-person-input
            style="width: 100%"
            disabled
            v-model="basicForm.handlerId"
            placeholder="请选择申请人"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="basicForm.handlerId"
          ></h-select-person-input>
        </u-form-item>
        <u-form-item label="申请部门" prop="handlerDeptId" :borderBottom="false">
          <h-select-depart-input
            disabled
            v-model="basicForm.handlerDeptId"
            :departName="basicForm.proposerDeptText"
            placeholder="请选择部门"
            border="surround"
            style="width: 100%"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :title.sync="basicForm.proposerDeptText"
          ></h-select-depart-input>
        </u-form-item>
      </view>
      <view class="basic-style">
        <view class="basic-title basic-border">项目信息</view>

        <u-form-item label="项目名称" prop="projectName" :borderBottom="false" required>
          <u--input
            disabled
            placeholder="请选择项目名称"
            v-model="basicForm.projectName"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="项目编号" prop="finalNo" :borderBottom="false">
          <u--input v-model="basicForm.finalNo" disabled placeholder="请输入项目编号" border="surround"></u--input>
        </u-form-item>
        <u-form-item label="经营团队" prop="teamName" :borderBottom="false">
          <h-select-team-input
            disabled
            style="width: 100%"
            v-model="basicForm.teamName"
            objectField="basicForm.teamName"
            placeholder="请选择经营团队"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :tdlx="1"
          ></h-select-team-input>
        </u-form-item>
        <!-- <u-form-item
				label="经营公司"
				prop="businessCompanyId"
				:borderBottom="false"
				required>
				<h-select-company-input
					disabled
					style="width: 100%"
					v-model="basicForm.businessCompanyId"
					border="surround"
					placeholder="请选择经营公司"
					suffixIcon="arrow-down-fill"
					:suffixIconStyle="{color: '#B2B2B2'}"
					objectField = 'basicForm.businessCompanyId'
				></h-select-company-input>
              </u-form-item> -->
        <u-form-item label="项目承接人" prop="undertaker" :borderBottom="false">
          <h-select-person-input
            style="width: 100%"
            disabled
            v-model="basicForm.undertaker"
            placeholder="请选择项目承接人"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="basicForm.undertaker"
          ></h-select-person-input>
        </u-form-item>
        <u-form-item label="立项日期" prop="projectEstablishDate" :borderBottom="false">
          <u--input
            v-model="basicForm.projectEstablishDate"
            disabled
            placeholder="请选择立项日期"
            border="surround"
            suffixIcon="calendar-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="签订单位" prop="signUnit" :borderBottom="false">
          <h-select-company-input
            disabled
            style="width: 100%"
            v-model="basicForm.signUnit"
            border="surround"
            placeholder="请选择签订单位"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="basicForm.signUnit"
          ></h-select-company-input>
        </u-form-item>
        <u-form-item label="业绩归属年度" prop="year" :borderBottom="false">
          <h-dict-select
            style="width: 100%"
            v-model="basicForm.year"
            disabled
            placeholder="请选择业绩归属年度"
            dictName="yjgsnd"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-dict-select>
        </u-form-item>

        <u-form-item label="业主单位" prop="ownerUnit" :borderBottom="false">
          <h-select-customer-input
            disabled
            style="width: 100%"
            v-model="basicForm.ownerUnit"
            commercialType="1"
            border="surround"
            placeholder="请选择业主单位"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="basicForm.ownerUnit"
          ></h-select-customer-input>
        </u-form-item>
        <u-form-item label="联系人" prop="contacts" :borderBottom="false">
          <h-dict-select
            style="width: 100%"
            v-model="basicForm.contacts"
            disabled
            placeholder="请选择联系人"
            :dictName="cust_lxr"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-dict-select>
        </u-form-item>
        <u-form-item label="联系方式" prop="contactTel" :borderBottom="false">
          <u--input v-model="basicForm.contactTel" disabled placeholder="请输入联系方式"></u--input>
        </u-form-item>
        <u-form-item label="项目所在地址" prop="areaCode" :borderBottom="false">
          <h-select-address-input
            disabled
            style="width: 100%"
            v-model="basicForm.areaCode"
            placeholder="请选择项目地址"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-select-address-input>
        </u-form-item>
        <u-form-item label="项目详细地址" prop="projectAddress" :borderBottom="false">
          <u--input v-model="basicForm.projectAddress" disabled placeholder="请输入项目详细地址"></u--input>
        </u-form-item>
        <u-form-item label="项目来源" prop="projectSource" :borderBottom="false">
          <h-dict-select
            style="width: 100%"
            v-model="basicForm.projectSource"
            disabled
            placeholder="请选择项目来源"
            dictName="xmly_type"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-dict-select>
        </u-form-item>
        <u-form-item label="预计合同额(元)" prop="estimatedContractAmount" :borderBottom="false">
          <u--input v-model="basicForm.estimatedContractAmount" disabled placeholder="请输入预计合同额"></u--input>
        </u-form-item>
        <u-form-item label="预计合同额大写" prop="estimatedContractcapitalChineseAmount" :borderBottom="false">
          <u--input v-model="basicForm.estimatedContractcapitalChineseAmount" disabled placeholder="请输入预计合同额大写"></u--input>
        </u-form-item>
        <u-form-item label="立项事由及说明" prop="establishReason" :borderBottom="false">
          <u--textarea
            v-model="basicForm.establishReason"
            :maxlength="500"
            disabled
            confirmType="done"
            placeholder="请输入立项事由及说明"
          ></u--textarea>
        </u-form-item>
        <u-form-item label="项目附件" prop="attachment" :borderBottom="false">
          <file-list v-model="basicForm.attachment"></file-list>
        </u-form-item>
      </view>

      <view class="basic-style">
        <view class="basic-title basic-border">任务信息</view>

        <u-form-item label="任务编号" prop="taskNo" :borderBottom="false" required>
          <u--input
            v-model="basicForm.taskNo"
            disabled
            placeholder="请选择任务编号"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="业务分类" prop="categoryName" :borderBottom="false">
          <u--input
            v-model="basicForm.categoryName"
            disabled
            placeholder="请选择业务分类"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="合同占比(%)" prop="contractRate" :borderBottom="false">
          <u--input
            v-model="basicForm.contractRate"
            disabled
            placeholder="请选择合同占比"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="合同分配额(元)" prop="contractAmount" :borderBottom="false">
          <u--input
            v-model="basicForm.contractAmount"
            disabled
            placeholder="请选择合同分配额"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="切割合同额(元)" prop="cutContractAmount" :borderBottom="false">
          <u--input
            v-model="basicForm.cutContractAmount"
            disabled
            placeholder="请选择切割合同额"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></u--input>
        </u-form-item>
        <u-form-item label="生产团队" prop="productTeam" :borderBottom="false">
          <h-select-team-input
            style="width: 100%"
            disabled
            v-model="basicForm.productTeam"
            objectField="basicForm.productTeam"
            placeholder="请选择生产团队"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :tdlx="2"
          ></h-select-team-input>
        </u-form-item>
        <u-form-item label="任务类型" prop="taskType" :borderBottom="false">
          <h-dict-select
            style="width: 100%"
            disabled
            v-model="basicForm.taskType"
            placeholder="请选择任务类型"
            dictName="task_type"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
          ></h-dict-select>
        </u-form-item>
        <u-form-item label="实施部门" prop="executeDepart" :borderBottom="false">
          <h-select-depart-input
            v-model="basicForm.executeDepart"
            :departName="basicForm.executeDepartText"
            placeholder="请选择部门"
            disabled
            border="surround"
            style="width: 100%"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            :title.sync="basicForm.executeDepartText"
            @detail="onExecuteDepartInput"
          ></h-select-depart-input>
        </u-form-item>
        <u-form-item label="部门负责人" prop="minister" :borderBottom="false">
          <h-select-person-input
            style="width: 100%"
            v-model="basicForm.minister"
            placeholder="请选择部门负责人"
            border="surround"
            disabled
            isMulti
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="basicForm.minister"
          ></h-select-person-input>
        </u-form-item>
        <u-form-item label="项目负责人" prop="projectLeading" :borderBottom="false">
          <h-select-person-input
            style="width: 100%"
            v-model="basicForm.projectLeading"
            placeholder="请选择项目负责人"
            border="surround"
            disabled
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            objectField="basicForm.projectLeading"
          ></h-select-person-input>
        </u-form-item>
        <template v-if="basicForm.taskType == 1 || basicForm.taskType == 4">
          <u-form-item v-if="basicForm.taskType == 1" label="审核工程师" prop="approvalEngineer" :borderBottom="false" required>
            <h-select-person-input
              style="width: 100%"
              v-model="basicForm.approvalEngineer"
              placeholder="请选择审核工程师"
              border="surround"
              suffixIcon="arrow-down-fill"
              :suffixIconStyle="{ color: '#B2B2B2' }"
              objectField="basicForm.approvalEngineer"
            ></h-select-person-input>
          </u-form-item>
          <u-form-item label="审批级别" prop="approvalLevel" :borderBottom="false">
            <h-dict-select
              style="width: 100%"
              disabled
              v-model="basicForm.approvalLevel"
              placeholder="请选择审批级别"
              dictName="approval_level"
              suffixIcon="arrow-down-fill"
              :suffixIconStyle="{ color: '#B2B2B2' }"
            ></h-dict-select>
          </u-form-item>
          <u-form-item label="审批系数" prop="approvalCoefficient" :borderBottom="false">
            <u--input
              v-model="basicForm.approvalCoefficient"
              type="number"
              disabled
              @blur="onBlur(basicForm.approvalCoefficient, 'approvalCoefficient')"
              placeholder="请选择审批系数"
              border="surround"
            ></u--input>
          </u-form-item>
          <u-form-item label="行业类别" prop="industryCategory" :borderBottom="false">
            <h-dict-select
              style="width: 100%"
              disabled
              v-model="basicForm.industryCategory"
              placeholder="请选择行业类别"
              dictName="industry_category"
              suffixIcon="arrow-down-fill"
              :suffixIconStyle="{ color: '#B2B2B2' }"
            ></h-dict-select>
          </u-form-item>
          <u-form-item label="行业系数" prop="industryCoefficient" :borderBottom="false">
            <u--input
              v-model="basicForm.industryCoefficient"
              placeholder="请输入行业系数"
              type="number"
              disabled
              @blur="onBlur(basicForm.industryCoefficient, 'industryCoefficient')"
              border="surround"
            ></u--input>
          </u-form-item>
          <u-form-item label="复杂程度" prop="complexity" :borderBottom="false">
            <h-dict-select
              style="width: 100%"
              v-model="basicForm.complexity"
              placeholder="请选择复杂程度"
              disabled
              dictName="industry_coefficient"
              suffixIcon="arrow-down-fill"
              :suffixIconStyle="{ color: '#B2B2B2' }"
            ></h-dict-select>
          </u-form-item>
          <u-form-item label="复杂系数" prop="complexCoefficient" :borderBottom="false">
            <u--input
              v-model="basicForm.complexCoefficient"
              type="number"
              disabled
              @blur="onBlur(basicForm.complexCoefficient, 'complexCoefficient')"
              placeholder="请输入复杂系数"
              border="surround"
            ></u--input>
          </u-form-item>
        </template>
        <!-- 当任务类型为检验检测时，展示本项 -->
        <template v-if="basicForm.taskType == 2">
          <u-form-item label="是否出具报告" prop="isOutReport" :borderBottom="false">
            <h-dict-radio disabled v-model="basicForm.isOutReport" dictName="YES_OR_NO"></h-dict-radio>
          </u-form-item>
          <u-form-item label="费用核算方式" prop="expenseAccountingMethod" :borderBottom="false" required>
            <h-dict-select
              style="width: 100%"
              v-model="basicForm.expenseAccountingMethod"
              placeholder="请选择费用核算方式"
              dictName="expense_accounting_method"
              suffixIcon="arrow-down-fill"
              :suffixIconStyle="{ color: '#B2B2B2' }"
            ></h-dict-select>
          </u-form-item>
        </template>
        <u-form-item label="说明" prop="instruction" :borderBottom="false">
          <u--textarea v-model="basicForm.instruction" confirmType="done" :maxlength="500" placeholder="请输入说明"></u--textarea>
        </u-form-item>
      </view>

      <view class="basic-style">
        <!-- ManagerEntrustType -->
        <view class="basic-title basic-border">项目成员</view>
        <template v-if="distributionDtList && distributionDtList.length">
          <view class="inforamtion" style="display: flex" v-for="(item, index) in distributionDtList" :key="index">
            <view>
              <view class="option" style="width: 520rpx">
                <view class="lf">项目成员</view>
                <view class="rl">{{ filterMultiDictText(dictOptions['projectMember'], item.projectMember + '') }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">分配合同额(元)</view>
                <view class="rl">{{ item.contractAmount }}</view>
              </view>
              <!-- <view class="option" style="width: 520rpx">
                <view class="lf">切割合同额(元)</view>
                <view class="rl">{{ item.cutContractAmount }}</view>
              </view> -->
              <view class="option" style="width: 520rpx">
                <view class="lf">合同额占比(%)</view>
                <view class="rl">{{ item.contractRate }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">工时单价(元)</view>
                <view class="rl">{{ item.dayCost }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">预算工时(小时)</view>
                <view class="rl">{{ item.expectWorkTime }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">项目绩效(元)</view>
                <view class="rl">{{ item.projectPerformance }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">人工成本(元)</view>
                <view class="rl">{{ item.laborCost }}</view>
              </view>
            </view>
            <!-- <view style="flex: 1; display: flex; align-items: center; justify-content: flex-end">
              <u-icon name="edit-pen-fill" color="#2979ff" size="20" @click="onManagerEntrustEdit(item, index)"></u-icon>
              <u-line direction="col" length="20" margin="0 10rpx"></u-line>
              <u-icon name="trash-fill" color="#2979ff" size="20" @click="onManagerEntrustDelete(item, index)"></u-icon>
            </view> -->
          </view>
        </template>

        <view v-else>
          <u-empty mode="data" icon="/static/empty/data.png"></u-empty>
        </view>
        <!-- <view  style="margin: 20rpx 20rpx 0rpx 20rpx;">
					<u-button text="新增" type="primary" @click="onManagerEntrustAdd"></u-button>
				</view> -->
      </view>

      <view class="basic-style">
        <view class="basic-title basic-border">项目预算</view>
        <u-form-item label="预算总工时(人小时)" prop="expectWorkTime" :borderBottom="false" required>
          <u--input
            disabled
            v-model="basicForm.expectWorkTime"
            type="number"
            @blur="onBlur(basicForm.expectWorkTime, 'expectWorkTime')"
            placeholder="请输入预算总工时"
            border="surround"
          ></u--input>
        </u-form-item>
				<u-form-item label="生产总绩效(元)" prop="totalProductPerformance">
				  <u--input type="number" disabled  placeholder="请输入生产总绩效" v-model="basicForm.totalProductPerformance"></u--input>
				</u-form-item>
        <u-form-item label="人工总成本(元)" prop="workCost" :borderBottom="false" required>
          <u--input
            disabled
            v-model="basicForm.workCost"
            type="number"
            @blur="onBlurBaicMoney(basicForm.workCost, 'workCost')"
            placeholder="请输入人工总成本"
            border="surround"
          ></u--input>
        </u-form-item>

        <u-form-item label="委外费(元)" prop="outsourcingFee" :borderBottom="false" required>
          <u--input
            disabled
            v-model="basicForm.outsourcingFee"
            type="number"
            @blur="onBlurBaicMoney(basicForm.outsourcingFee, 'outsourcingFee')"
            placeholder="请输入委外费"
            border="surround"
          ></u--input>
        </u-form-item>
        <u-form-item label="差旅费(元)" prop="travelFee" :borderBottom="false" required>
          <u--input
            disabled
            v-model="basicForm.travelFee"
            type="number"
            @blur="onBlurBaicMoney(basicForm.travelFee, 'travelFee')"
            placeholder="请输入差旅费"
            border="surround"
          ></u--input>
        </u-form-item>
        <u-form-item label="专家评审费(元)" prop="professionReviewFee" :borderBottom="false" required>
          <u--input
            disabled
            v-model="basicForm.professionReviewFee"
            type="number"
            @blur="onBlurBaicMoney(basicForm.professionReviewFee, 'professionReviewFee')"
            placeholder="请输入专家评审费"
            border="surround"
          ></u--input>
        </u-form-item>
        <u-form-item label="其他成本(元)" prop="otherCost" :borderBottom="false" required>
          <u--input
            disabled
            v-model="basicForm.otherCost"
            type="number"
            @blur="onBlurBaicMoney(basicForm.otherCost, 'otherCost')"
            placeholder="请输入其他成本"
            border="surround"
          ></u--input>
        </u-form-item>
        <u-form-item label="项目预算合计(元)" prop="totalProjectBudget" :borderBottom="false" required>
          <u--input
            disabled
            v-model="basicForm.totalProjectBudget"
            type="number"
            @blur="onBlurBaicMoney(basicForm.totalProjectBudget, 'totalProjectBudget')"
            placeholder="请输入项目预算合计"
            border="surround"
          ></u--input>
        </u-form-item>
				<template v-if="basicForm.categoryName">
					<view v-if="isProjectInformation">
					  <view class="basic-title basic-border">项目预算表</view>
					  <view class="py-1 space-y-1" style="width: 100%">
					    <file-list v-if="basicForm.projectBudgetFile" v-model="basicForm.projectBudgetFile"></file-list>
							<view v-else>
								<u-empty
									mode="data"
									text="暂无项目预算表"
									icon="/static/empty/data.png"
								></u-empty>
							</view>
					  </view>
					</view>
					<view v-else>
					  <view class="basic-title basic-border">生产绩效表</view>
					  <view class="py-1 space-y-1" style="width: 100%">
					    <file-list v-if="basicForm.productBudgetFile" v-model="basicForm.productBudgetFile"></file-list>
							<view v-else>
								<u-empty
									mode="data"
									text="暂无生产绩效表"
									icon="/static/empty/data.png"
								></u-empty>
							</view>
					  </view>
					</view>
				</template>
      </view>

      <view class="basic-style">
        <view class="basic-title basic-border">任务进度</view>
        <u-form-item label="进度模板" prop="templateId" :borderBottom="false">
          <!-- disabled -->
          <h-select-process-template-input
            style="width: 100%"
            disabled
            v-model="basicForm.templateId"
            objectField="basicForm.templateId"
            placeholder="请选择进度模板"
            border="surround"
            suffixIcon="arrow-down-fill"
            :suffixIconStyle="{ color: '#B2B2B2' }"
            @input="onTemplateDetail"
          ></h-select-process-template-input>
        </u-form-item>
				<u-form-item label="允许添加子节点" prop="isAddChildNode">
				  <h-select-input-tag
						disabled
				    class="w-100"
				    v-model="basicForm.isAddChildNode"
				    objectField="basicForm.isAddChildNode"
				    placeholder="请选择允许添加子节点"
				    border="surround"
						suffixIcon="arrow-down-fill"
						:suffixIconStyle="{ color: '#B2B2B2' }"
				    dictName="yes_no"
				  ></h-select-input-tag>
				</u-form-item>
				<u-form-item label="收入确认方式" prop="confirmIncomeMethod">
				  <h-select-input-tag
				    class="w-100"
						disabled
				    v-model="basicForm.confirmIncomeMethod"
				    objectField="basicForm.confirmIncomeMethod"
				    placeholder="请选择收入确认方式"
				    border="surround"
						suffixIcon="arrow-down-fill"
						:suffixIconStyle="{ color: '#B2B2B2' }"
				    dictName="confirm_income_method"
				  ></h-select-input-tag>
				</u-form-item>
        <u-collapse v-if="progressVoList && progressVoList.length" ref="collapse" :border="false">
          <u-collapse-item title="进度模板" name="Docs guide">
            <template>
              <view class="inforamtion" style="display: flex" v-for="(item, index) in progressVoList" :key="index">
                <view>
                  <view class="option" style="width: 520rpx">
                    <view class="lf">节点名称</view>
                    <view class="rl">{{ item.nodeName }}</view>
                  </view>
                  <view class="option" style="width: 520rpx">
                    <view class="lf">节点进度</view>
                    <view class="rl">{{ item.nodeProgress ? item.nodeProgress + '%' : 0 + '%' }}</view>
                  </view>
									<view class="option" style="width: 520rpx">
									  <view class="lf">收入确认节点</view>
									  <view class="rl">{{ item.isConfirmIncomeNode_dictText }}</view>
									</view>
                </view>
              </view>
            </template>
          </u-collapse-item>
        </u-collapse>
        <view v-else>
          <u-empty mode="data" icon="/static/empty/data.png"></u-empty>
        </view>
      </view>

      <view class="basic-style">
        <!-- ManagerEntrustType -->
        <view class="basic-title basic-border">款项进度</view>
        <template v-if="progressNodeVoList && progressNodeVoList.length">
          <view class="inforamtion" style="display: flex" v-for="(item, index) in progressNodeVoList" :key="index">
            <view>
              <view class="option" style="width: 520rpx">
                <view class="lf">款项名称</view>
                <view class="rl">{{ item.nodeName }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">金额(元)</view>
                <view class="rl">{{ item.paymentMoney }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">款项节点说明</view>
                <view class="rl">{{ item.nodeDesc }}</view>
              </view>
              <!-- <view class="option" style="width: 520rpx">
                <view class="lf">是否关联任务</view>
                <view class="rl">
                  {{
                    item.isRelatedTask === '' || item.isRelatedTask === null || item.isRelatedTask === undefined
                      ? ''
                      : item.isRelatedTask == 0
                      ? '否'
                      : '是'
                  }}
                </view>
              </view> -->
              <!-- <view class="option" style="width: 520rpx">
                <view class="lf">是否关联进度</view>
                <view class="rl">
                  {{
                    item.isRelatedTaskNode === '' || item.isRelatedTaskNode === null || item.isRelatedTaskNode === undefined
                      ? ''
                      : item.isRelatedTaskNode == 0
                      ? '否'
                      : '是'
                  }}
                </view>
              </view> -->
              <view class="option" style="width: 520rpx">
                <view class="lf">本任务关联款项金额(元)</view>
                <view class="rl">{{ item.taskPaymentMoney }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">任务进度</view>
                <view class="rl">{{ item.taskNodeId_dictText }}</view>
              </view>
              <view class="option" style="width: 520rpx">
                <view class="lf">节点进度(%)</view>
                <view class="rl">{{ item.taskProgress }}</view>
              </view>
            </view>
            <!-- <view style="flex: 1; display: flex; align-items: center; justify-content: flex-end;">
							<u-icon name="edit-pen-fill" color="#2979ff" size="20" @click="onManagerEntrustEdit(item, index)"></u-icon>
							<u-line  direction="col" length="20" margin="0 10rpx"></u-line>
							<u-icon  name="trash-fill" color="#2979ff" size="20"  @click="onManagerEntrustDelete(item, index)"></u-icon>
						</view> -->
          </view>
        </template>

        <view v-else>
          <u-empty mode="data" icon="/static/empty/data.png"></u-empty>
        </view>
        <!-- <view  style="margin: 20rpx 20rpx 0rpx 20rpx;">
					<u-button text="新增" type="primary" @click="onManagerEntrustAdd"></u-button>
				</view> -->
      </view>
    </u--form>

    <!-- 附件 -->
    <view class="basic-style">
      <view class="basic-title basic-border">任务附件</view>
      <view class="" style="width: 100%">
        <h-upload-file v-model="basicForm.taskFile" :isIcon="false"></h-upload-file>
        <file-list v-if="basicForm.taskFile" v-model="basicForm.taskFile" :isDelete="true"></file-list>
      </view>
    </view>

    <view class="space-x-1 px-1 btn_position">
    	<backButton  @onSubmit="onSubmit" :nodeObj="nodeObj" :model="model" :resultObj="resultObj"></backButton>
    </view>
    <view style="height: 100rpx;"></view>
    <!-- 项目成员情况 -->
    <u-popup
      :show="showManagerTrusteePopup"
      @close="closeManagerTrusteePopup"
      :round="10"
      :customStyle="{ maxHeight: '600px', padding: '20rpx 0' }"
    >
      <view style="background-color: #ffffff; border-radius: 10px; padding: 20rpx; overflow: auto">
        <u--form
          labelPosition="top"
          :model="managerTrusteeForm"
          ref="form1"
          labelWidth="auto"
          :labelStyle="{
            fontSize: '14px',
            color: '#B2B2B2',
            lineHight: '20px',
          }"
        >
          <u-form-item label="项目成员" prop="projectMember" :borderBottom="false" required>
            <h-select-person-input
              style="width: 100%"
              v-model="managerTrusteeForm.projectMember"
              placeholder="项目成员"
              border="surround"
              suffixIcon="arrow-down-fill"
              :suffixIconStyle="{ color: '#B2B2B2' }"
              objectField="managerTrusteeForm.projectMember"
            ></h-select-person-input>
          </u-form-item>
          <u-form-item label="分配合同额(元)" prop="contractAmount" :borderBottom="false" required>
            <u--input
              v-model="managerTrusteeForm.contractAmount"
              placeholder="请输入分配合同额"
              border="surround"
              type="number"
              @change="moneyChange"
              @blur="onMoneyBlur(managerTrusteeForm.contractAmount)"
            ></u--input>
          </u-form-item>
          <u-form-item label="合同额占比(%)" prop="contractRate" :borderBottom="false" required>
            <u--input
              v-model="managerTrusteeForm.contractRate"
              placeholder="成员匹配合同额/任务委托合同额"
              border="surround"
              type="number"
              disabled
            ></u--input>
          </u-form-item>
        </u--form>
        <view style="padding-bottom: 20rpx">
          <u-button text="确定" type="primary" @click="onConfirmManagerTrusteePopup"></u-button>
        </view>
      </view>
    </u-popup>
    <u-toast ref="uToast"></u-toast>
  </view>
</template>

<script>
import http from '@/utils/request'
import fileList from './components/fileList.vue'
import backButton from '@/components/backButton.vue'
import { filterMultiDictText, initDictOptions } from '@/utils/JDictSelectUtil.js'
import {
	getProcessTaskTransInfo, // 流程流转
  erpOmcTaskDistributionId, // 根据id查询任务委托详情
  erpOmcProjectId, // 获取项目详情
  erpOmcTaskDistributionDtList, // 获取项目成员列表
  erpOmcTaskDistributionEdit, // 编辑
  queryUsersByUsernames, // 部门负责人带入
  erpProgressTemplateDtList, // 进度模板
  erpOmcTaskDistributionPaymentList, // 款项进度列表
  erpOmcTaskDistributionPaymentNodeList, // 款项进度编辑列表
} from '@/api/index.js'
import { BASE_URL } from '@/utils/baseUrl.js'
import { convertCurrency } from '@/utils/MoneyConvert' // 金额大写转换
import { mapState } from 'vuex'
export default {
  components: {
    fileList,
		backButton
  },
  data() {
    return {
			resultObj: {}, // 流程图流转信息
      progressVoList: [], // 进度模板
      progressNodeVoList: [], // 款项进度列表

      filterMultiDictText,
      initDictOptions,
      dictOptions: {},
      cust_lxr: 'erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id=0',
      distributionDtList: [], // 项目成员列表
      showManagerTrusteePopup: false, // 弹窗开关
      clickManagerEntrustPopup: '', // 点击编辑还是新增
      commissionedIndex: 0, // 点击编辑的index值
      managerTrusteeForm: {
        projectMember: '',
        contractAmount: '',
        contractRate: '',
      }, // 对象

      isRefresh: false, // 获取项目信息时是否清空数据 false - 不清空
      isContractNoInfoRefresh: false, // 获取合同信息时是否清空数据 false - 不清空
      isSubmit: false,
      basicForm: {},
      nodeObj: {},
      tabvalue: '',
      id: '', // 详情id值
      model: {},

      clickManagerTrusteePopup: '', // 点击编辑还是新增

      managerTrusteeIndex: 0, // 点击编辑的index值
      userInformation: '', // 用户信息
    }
  },
  onLoad(options) {
    // 获取用户信息
    this.userInformation = this.userInfo()
    this.model = JSON.parse(decodeURIComponent(options.item))
    this.initDictConfig()
    var that = this
    // #ifdef APP-NVUE
    var eventChannel = this.$scope.eventChannel // 兼容APP-NVUE
    // #endif
    // #ifndef APP-NVUE
    var eventChannel = this.getOpenerEventChannel()
    // #endif
    // 监听sendMessage事件，获取上一页面通过eventChannel传送到当前页面的数据
    eventChannel.on('sendMessage', function (data) {
      that.tabvalue = data.tabvalue
      that.nodeObj = JSON.parse(decodeURIComponent(data.nodeObj))
      that.id = that.nodeObj.dataId
      that.loadData(that.nodeObj.dataId)
			that.getProcessTaskTrans(that.model.id)
    })
  },
	computed: {
		// 判断是否为工程运维或者数字信息的业务分类
		isProjectInformation() {
			// 判断categoryName是否含有工程运维或者数字信息
			if (this.basicForm.categoryName && (this.basicForm.categoryName.indexOf('工程运维') !== -1 || this.basicForm.categoryName.indexOf('数字信息') !== -1)) {
				return true
			} else {
				return false
			}
		}
	},
  methods: {
    ...mapState(['userInfo']),
    loadData(id) {
      erpOmcTaskDistributionId({ id }).then(async (res) => {
        if (res.success) {
          this.basicForm = res.result
          // 获取项目编号
          this.projectNumber(res.result.projectId)
          this.taskNumber(res.result.taskId)
          this.getMemberList(res.result.id)
          this.cust_lxr = "erp_omc_customer_manager_contact,lxr,id,del_flag=0 and main_id='" + res.result.ownerUnit + "'"

          this.queryPaymentNodeListByMainId(res.result.id) // 获取款项进度列表
          // 获取任务进度列表
          if (res.result.id) {
            this.getEditTemplateDtList(res.result.id)
          }
        } else {
          this.$refs.uToast.show({
            message: res.message,
            type: 'error',
          })
        }
      })
    },

    // 获取项目编号
    projectNumber(projectId) {
      erpOmcProjectId({ id: projectId }).then((res) => {
        if (res.success) {
          this.$set(this.basicForm, 'finalNo', res.result.finalNo) // 项目编号
        } else {
          this.$refs.uToast.show({
            message: res.message,
            type: 'error',
          })
        }
      })
    },
    // 获取任务编号
		taskNumber(taskId) {
		  http.get('/api/erp/omc/project/erpOmcProjectTask/queryById', { id: taskId }).then((res) => {
		    if (res.success) {
		      var event = res.result
		      this.$set(this.basicForm, 'taskNo', event.billNo?event.billNo: taskId) // 任务编号
		    } else {
					this.$set(this.basicForm, 'taskNo', taskId) // 任务编号
		      this.$refs.uToast.show({
		        message: res.message,
		        type: 'error',
		      })
		    }
		  }).catch(err => {
				this.$set(this.basicForm, 'taskNo', taskId) // 任务编号
			})
		},

    // 获取项目成员列表
    getMemberList(mainId) {
      erpOmcTaskDistributionDtList({ mainId }).then((res) => {
        if (res.success) {
          this.distributionDtList = res.result || []
        } else {
          this.$refs.uToast.show({
            message: res.message,
            type: 'error',
          })
        }
      })
    },

    // 获取款项进度列表
    queryPaymentListByProjectId(taskId) {
      this.progressNodeVoList = []
      erpOmcTaskDistributionPaymentList({ taskId }).then((res) => {
        if (res.success) {
          this.progressNodeVoList = res.result
        }
      })
    },
    // 编辑获取款项进度列表
    queryPaymentNodeListByMainId(id) {
      if (!id) {
        return false
      }
      this.progressNodeVoList = []
      erpOmcTaskDistributionPaymentNodeList({ id }).then((res) => {
        if (res.success) {
          this.progressNodeVoList = res.result
        } else {
          this.queryPaymentListByProjectId(this.basicForm.taskId) // 获取款项进度列表
        }
      })
    },

    // 选择进度模板
    onTemplateDetail(item) {
      this.getTemplateDtList(item.id)
    },

    // 获取进度模板
    getTemplateDtList(mainId) {
      erpProgressTemplateDtList({ mainId }).then((res) => {
        if (res.success) {
          this.progressVoList = res.result
          this.$nextTick(() => {
            this.$refs.collapse.init()
          })
        }
      })
    },
		
		// 获取编辑进度模板
		getEditTemplateDtList(id) {
		  http.get('/api/erp/omc/task/erpOmcTaskDistribution/queryTaskNodeListByMainId',{ id }).then((res) => {
		    if (res.success) {
					if (res.result && res.result.length) {
					  this.progressVoList = res.result
						this.$nextTick(() => {
						  this.$refs.collapse.init()
						})
					}
		    }
		  })
		},

    async initDictConfig() {
      // 人员名称
      initDictOptions('erp_employee_file,name,id').then((res) => {
        if (res.success) {
          this.$set(this.dictOptions, 'projectMember', res.result)
        }
      })
    },

    // 选择实施部门
    onExecuteDepartInput(item) {
      if (!item[0].minister) {
        this.$set(this.basicForm, 'minister', undefined)
        return false
      }
      //
      // 复制部门负责人
      queryUsersByUsernames({ usernames: item[0].minister }).then((res) => {
        var idsArr = []
        var ids = ''
        if (res && res.length) {
          res.map((value) => {
            idsArr.push(value.empId)
          })
        }
        ids = idsArr.toString()

        this.$set(this.basicForm, 'minister', ids)
      })
    },

    // 约束数字输入框
    onBlur(item, text) {
      if (item == undefined || item == null) {
        return false
      }
      var num = Number(item)
      if (num <= 0) {
        num = 0
      }
      if (num >= 99999) {
        num = 99999
      }
      this.basicForm[text] = num.toFixed(1)
    },
    onBlurBaicMoney(item, text) {
      if (item == undefined || item == null) {
        return false
      }
      var num = Number(item)
      if (num <= 0) {
        num = 0
      }
      if (num >= 99999999) {
        num = 99999999
      }
      this.basicForm[text] = num.toFixed(2)
    },

    // 点击编辑
    onManagerEntrustEdit(item, index) {
      this.managerTrusteeForm = { ...item }
      this.commissionedIndex = index
      this.clickManagerEntrustPopup = 'edit'
      this.showManagerTrusteePopup = true
    },
    // 点击删除
    onManagerEntrustDelete(item, index) {
      let _this = this
      uni.showModal({
        title: '确定删除',
        content: '确定删除此信息？',
        success(res) {
          if (res.confirm) {
            _this.distributionDtList.splice(index, 1)
          } else if (res.cancel) {
            // 用户点击取消
          }
        },
      })
    },

    // 点击新增
    onManagerEntrustAdd() {
      this.managerTrusteeForm = {
        projectMember: '',
        contractAmount: '',
        contractRate: '',
      } // 对象
      this.clickManagerEntrustPopup = 'add'
      this.showManagerTrusteePopup = true
    },

    //输入金额
    moneyChange(item) {
			if (!Number(this.basicForm.contractAmount)) {
				return this.managerTrusteeForm.contractRate = 0.00
			}
      this.managerTrusteeForm.contractRate = (
        (Number(this.managerTrusteeForm.contractAmount) / Number(this.basicForm.contractAmount)) *
        100
      ).toFixed(2)
    },

    // 金额约束
    onMoneyBlur(item) {
      if (item == undefined || item == null) {
        return false
      }
      var num = Number(item)
      if (num <= 0) {
        num = 0
      }
      if (num >= 99999999) {
        num = 99999999
      }
      this.managerTrusteeForm.contractAmount = num.toFixed(2)
    },

    showMessage(message) {
      uni.showToast({
        title: message,
        icon: 'none',
      })
    },
    // 子表确定按钮
    onConfirmManagerTrusteePopup() {
      // this.getManagerTrusteeId(this.managerTrusteeForm.gsdaId)
      if (!this.managerTrusteeForm.projectMember) {
        this.showMessage('请选择项目成员')
        return
      }
      if (this.managerTrusteeForm.contractAmount == '' || this.managerTrusteeForm.contractAmount == null) {
        this.showMessage('请输入分配合同额')
        return
      }
      if (this.managerTrusteeForm.contractRate == '' || this.managerTrusteeForm.contractRate == null) {
        this.showMessage('请输入合同额占比')
        return
      }
      if (this.clickManagerTrusteePopup == 'edit') {
        this.distributionDtList[this.commissionedIndex] = this.managerTrusteeForm
      } else {
        this.managerTrusteeForm.mainId = this.basicForm.id
        this.managerTrusteeForm.id = parseInt(Math.random() * 1000000000000)
        this.distributionDtList.push(this.managerTrusteeForm)
      }
      this.showManagerTrusteePopup = false
      this.managerTrusteeForm = {
        projectMember: '',
        contractAmount: '',
        contractRate: '',
      } // 对象
    },

    // 关闭子表弹窗
    closeManagerTrusteePopup() {
      this.isRefresh = false
      this.isCheckoutInfoRefresh = false
      this.isContractNoInfoRefresh = false
      this.showManagerTrusteePopup = false
    },
		
		// 查询流程流转信息 -- 获取下一节点信息
		getProcessTaskTrans(taskId){
			getProcessTaskTransInfo({ taskId }).then(res => {
				if(res.success){
					this.resultObj = res.result
				} else {
					this.$refs.uToast.show({
						message: res.message,
						type: 'error'
					})
				}
			}).catch(err => {
				console.log(err);
			})
		},
		
    // 点击提交
    onSubmit() {
			var _this = this
      // 环评咨询
      if (this.basicForm.taskType == 1) {
        if (!this.basicForm.approvalEngineer) {
          uni.showToast({
            title: '请选择审核工程师',
            icon: 'none',
          })
          return false
        }
      }
      var params = this.basicForm
      if (this.distributionDtList && this.distributionDtList.length) {
        params.distributionDtList = this.distributionDtList
      }
			params.progressNodeVoList = this.progressNodeVoList // 款项详情
			params.progressVoList = this.progressVoList || [] // 任务进度
      erpOmcTaskDistributionEdit(params).then((res) => {
        if (res.success) {
          this.$refs.uToast.show({
          	message: '提交成功',
          	type: 'success',
          	complete () {
          		_this.onAudit()
          	}
          })
          this.isSubmit = true
        } else {
          this.$refs.uToast.show({
            message: res.message,
            type: 'error',
          })
        }
      })
    },

    onAudit() {
      if (!this.isSubmit) {
        uni.showToast({
          title: '请完善表单后审核',
          icon: 'none',
        })
        return false
      }
      var that = this
      uni.navigateTo({
        url: '/pages/synergy/ErpOmcTaskDistributionForm' + `?item=${encodeURIComponent(JSON.stringify(this.model).replace(/%/g, '%25'))}`,
        events: {
          // 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
          // acceptDataFromOpenedPage: function(data) {
          // 	console.log(data);
          // }
        },
        success: function (data) {
          // 通过eventChannel向被打开页面传送数据
          var params = {
            nodeObj: encodeURIComponent(JSON.stringify(that.nodeObj).replace(/%/g, '%25')),
            tabvalue: that.tabvalue,
          }
          data.eventChannel.emit('sendMessage', params)
        },
        fail: function (err) {
          this.$refs.uToast.show({
            message: '请联系管理员配置',
            type: 'error',
          })
        },
      })
    },
  },
}
</script>

<style lang="scss" scoped>
@import url("@/assets/inputStyle.scss");
// 评测信息
.info-title {
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #171717;
  line-height: 20px;
  padding-bottom: 16rpx;
}

// 评测结果
.result-style {
  font-size: 12px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #b2b2b2;
}

.inforamtion {
  margin-top: 10rpx;
  padding: 10rpx;
  border-radius: 15rpx;
  box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.1);
}
</style>
